package com.ehotting.eaf.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum LicensePeriodEnum {

    ONE_MONTH("1",30),
    THREE_MONTHS("2",30*3),
    SIX_MONTH("3",30*6),
    ONE_YEAR("4",365),
    ;
    // 数据字典的值
    private String dictValue;
    // 周期转换为多少天
    private Integer days;

    public static LicensePeriodEnum getByDictValue(String dictValue) {
        for (LicensePeriodEnum licensePeriodEnum : LicensePeriodEnum.values()) {
            if (licensePeriodEnum.getDictValue().equals(dictValue)) {
                return licensePeriodEnum;
            }
        }
        return ONE_MONTH;
    }

}
